package com.xt.feign;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Administrator on 2017/7/10.
 */
@Service
@FeignClient(value = "hello-service",fallback = HelloServiceFallback.class)
public interface HelloService {
    @RequestMapping("hello")
    String hello();

    /**
     * RequestParam("name")注解必填，否则会405错误
     * @param name
     * @return
     */
    @RequestMapping(value = "hello1",method = RequestMethod.GET)
    String hello(@RequestParam("name") String name);

    @RequestMapping(value = "hello2",method = RequestMethod.GET)
    User hello(@RequestHeader("name") String name, @RequestHeader("age") Integer age);

    @RequestMapping(value = "hello3",method = RequestMethod.POST)
    String hello(@RequestBody User user);
}
